package com.xicheng.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 试卷表
 * </p>
 *
 * @author com.xicheng
 * @since 2025-09-08
 */
@Getter
@Setter
@ToString
@TableName("exams")
@Accessors(chain = true)
public class Exams extends Model<Exams> {

    /**
     * 试卷ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 试卷标题
     */
    @TableField("title")
    private String title;

    /**
     * 描述
     */
    @TableField("description")
    private String description;

    /**
     * 总分
     */
    @TableField("total_score")
    private BigDecimal totalScore;

    /**
     * 题目数量
     */
    @TableField("question_count")
    private Integer questionCount;

    /**
     * 开考时间
     */
    @TableField("start_time")
    private LocalDateTime startTime;

    /**
     * 考试时长(分钟)
     */
    @TableField("duration")
    private Integer duration;

    /**
     * 状态：1-未发布，2-已发布，3-已结束
     */
    @TableField("status")
    private Boolean status;

    /**
     * 适用阶段ID，null表示全阶段
     */
    @TableField("stage_id")
    private Integer stageId;

    /**
     * 适用书籍ID，null表示全书籍
     */
    @TableField("book_id")
    private Integer bookId;

    /**
     * 创建者（老师ID）
     */
    @TableField("created_by")
    private Integer createdBy;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
